//
//  WaterFlowViewCell.m
//  WaterFlowStyle
//
//  Created by siqin.ljp on 12-5-16.
//  Copyright (c) 2012年 Taobao. All rights reserved.
//

#import "WaterFlowViewCell.h"
#import "XDHeader.h"
@implementation WaterFlowViewCell

@synthesize reuseIdentifier = _reuseIdentifier;
@synthesize indexPath = _indexPath;



-(id)initWithIdentifier:(NSString *)identifier
{
    self = [super init];
    if (self) {
        self.reuseIdentifier = identifier;
        self.clipsToBounds = YES;
        
        self.backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 150, 150)];
        _backView.backgroundColor = [UIColor greenColor];
        
        self.picImageVIew = [[[UIImageView alloc] init] autorelease];
        self.picImageVIew.clipsToBounds = YES;
//        self.picImageVIew.contentMode = UIViewContentModeScaleAs;
        self.picImageVIew.frame = CGRectMake(0, 0, 133, 86);
        self.picImageVIew.backgroundColor = UIColorFromRGB(0xdbdada);
        
        
        self.titleLabel = [[[UILabel alloc] init] autorelease];//width = 133
        self.titleLabel.frame = CGRectMake(_picImageVIew.frame.origin.x, self.picImageVIew.frame.origin.y+self.picImageVIew.frame.size.height, 133, 20);
        self.titleLabel.text = @"鲸鱼背上的世界";
        self.nameLabel.font = [UIFont systemFontOfSize:13.0];
        
        
        self.nameLabel = [[[UILabel alloc] init] autorelease];// height 28  y+=5
        self.nameLabel.frame = CGRectMake(self.titleLabel.frame.origin.x, self.titleLabel.frame.origin.y+self.titleLabel.frame.size.height+5 , 39, 28);
        self.nameLabel.text = @"李晓东";
        self.nameLabel.font = [UIFont systemFontOfSize:13.0];
        
        self.eyeImageView = [[[UIImageView alloc] init] autorelease];
        self.eyeImageView.frame = CGRectMake(self.nameLabel.frame.origin.x+80, self.nameLabel.frame.origin.y, 12, 8);
        self.eyeImageView.backgroundColor = [UIColor blueColor];
        
        
        self.countLabel = [[[UILabel alloc] init] autorelease];
        self.countLabel.frame = CGRectMake(self.eyeImageView.frame.origin.x+100, self.nameLabel.frame.origin.y, 22, 12);
        self.countLabel.text = @"124";
        self.countLabel.font = [UIFont systemFontOfSize:13.0];
        
        [self.backView addSubview:_picImageVIew];
        [self.backView addSubview:_titleLabel];
//        [self.backView addSubview:_nameLabel];
//        [self.backView addSubview:_eyeImageView];
//        [self.backView addSubview:_countLabel];
        
        [self addSubview:_backView];
        
        
       
        
        
    }
    return self;
}

- (id)initWithFrame:(CGRect)frame 
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}
//TODO：000
- (void)willMoveToSuperview:(UIView *)newSuperview
{
    [super willMoveToSuperview:newSuperview];
    if (!newSuperview) {
        
    }
}
//6.0 之后取消下载已消失的cell中的异步image;
//- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    VideoMessageCell * videoCell = (VideoMessageCell *)cell;
//    if (videoCell) {
//        //        [videoCell.videoImage cancelDownload];
//        [videoCell.videoImage cancelDownload];
//    }
//}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/
#pragma UIview代理方法
//- (void)willMoveToSuperview:(UIView *)newSuperview
//{
//
//    [_backView willMoveToSuperview:newSuperview];
//    if (!newSuperview) {
//        [_foodImageView cancelDownload];
//        [_peopleImageView cancelDownload];
//    }
//}

- (void)layoutSubviews
{
    [super layoutSubviews];
//    if (!self.foodImageView.superview) {
//        CGRect rect = self.frame;
//        rect.origin.x = rect.origin.y = 0.0f;
//        self.foodImageView.frame = rect;
//        self.bigLabel.frame=rect;
//        [self addSubview:self.foodImageView];
//        NSLog(@"000000000000000000000000000000");
//    }
//self.bigLabel.text=self.articleInfo.defaultText;

}
- (void)dealloc
{
    self.picImageVIew = nil;
    self.titleLabel = nil;
    self.nameLabel = nil;
    self.eyeImageView = nil;
    self.countLabel = nil;
    self.reuseIdentifier=nil;
    self.indexPath=nil;
    self.backView = nil;
    [super dealloc];
}
@end


/* ************************************************** */
@implementation WFIndexPath

@synthesize column = _column;
@synthesize row = _row;

+ (WFIndexPath *)indexPathForRow:(NSInteger)row inColumn:(NSInteger)column
{
    WFIndexPath *indexPath = [[[WFIndexPath alloc] init] autorelease];
    
    indexPath.column = column;
    indexPath.row = row;
    
    return indexPath;
}
- (void)dealloc
{
    
    [super dealloc];
}
@end
